using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public static class StaticExtensions
{
	public static void TryAddRange<T>(this List<T> lists, IEnumerable<T> its)
	{
		if (its != null && its.Count() != 0)
		{
			lists.AddRange(its);
		}
	}

	public static float Distance_2(this Vector2 v1, Vector2 v2)
	{
		float num = v2.x - v1.x;
		float num2 = v2.y - v1.y;
		return num * num + num2 * num2;
	}

	public static float Distance_2_2(this Vector2 v1, Vector2 v2)
	{
		return (v2 - v1).sqrMagnitude;
	}

	public static void RandOrder<T>(this List<T> list)
	{
		int count = list.Count;
		for (int i = 0; i < count; i++)
		{
			int index = Random.Range(0, count);
			T value = list[i];
			list[i] = list[index];
			list[index] = value;
		}
	}
}
